<template>
  <div class="authenticatedUser">
    <!-- <p class="title">认证</p> -->
    <div class="main">
      <div class="picture1">
        <img class="bg" src="../assets/image/authenticatedUser1.png" alt="" />
        <img class="gift" src="../assets/image/authenticatedUser2.png" alt="" />
      </div>

      <div class="last">
        <img class="gift" src="../assets/image/authenticatedUser3.png" alt="" />
      </div>
      <div class="btn" @click="submit">开始认证</div>
    </div>
  </div>
</template>

<script>
export default {
  methods: {
    submit() {
      //判断环境
      var u = navigator.userAgent;
      var isAndroid = u.indexOf("Android") > -1 || u.indexOf("Linux") > -1; //android终端或者uc浏览器
      var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
      if (isAndroid) {
        console.log("当前安卓环境");
        // this.getVipList();
        // 调用安卓app方法通知app刷新token并回调本地方法
        window.android.authentication();
      } else if (isiOS) {
        console.log("当前IOS环境");
        // this.getVipIos();
        // 调用苹果app方法通知app刷新token并回调本地方法
        window.webkit.messageHandlers.authentication.postMessage(
          "authenticationUser"
        );
      }
      //注册挂载全局方法等待app回调后resolve就可进行操作了
    },
  },
};
</script>

<style lang="less" scoped>
.authenticatedUser {
  width: 100%;
  background: #f6f6f6;
  .title {
    font-size: 20px;
    font-weight: bold;
    line-height: 50px;
    color: #333333;
    text-align: center;
    letter-spacing: 1px;
  }
  .main {
    padding: 0 0 15px 0;
    box-sizing: border-box;
    .picture1 {
      width: 100%;
      height: 500px;
      position: relative;
      margin-bottom: 120px;
      .gift {
        width: 90%;
        position: absolute;
        top: 80%;
        left: 5%;
      }
      // height: 1000px;
    }
    .last {
      width: 90%;
      margin: auto;
      // border: 1px dotted black;
      // padding: 3px;
      box-sizing: border-box;
    }
    .btn {
      width: 90%;
      height: 50px;
      background: linear-gradient(105deg, #d853ff 0%, #7439ff 100%);
      text-align: center;
      line-height: 50px;
      color: #fff;
      font-weight: bold;
      font-size: 17px;
      margin: 25px auto;
      border-radius: 25px;
    }
  }
}
</style>